package ai.zixing.factory.abstract_factory;

import ai.zixing.factory.abstract_factory.factory.AppliancesFactory;
import ai.zixing.factory.abstract_factory.factory.HisenserFactory;
import ai.zixing.factory.abstract_factory.product.AbstractFreezer;
import ai.zixing.factory.abstract_factory.product.AbstractTV;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class Client {

    private AbstractTV tv;

    private AbstractFreezer freezer;

    public Client(AppliancesFactory factory) {
        // 在客户端看来就是使用抽象工厂来生产家电
        this.tv = factory.createTV();
        this.freezer = factory.createFreezer();
    }


    public static void main(String[] args) {
        Client client = new Client(new HisenserFactory());
        AbstractTV tv1 = client.getTv();
        System.out.println(tv1);
        AbstractFreezer freezer1 = client.getFreezer();
        System.out.println(freezer1);
    }
}
